package com.tao.YanMoDesignPattern.observer.case3_Origin;

import com.tao.YanMoDesignPattern.observer.pattern.Subject;

import java.util.Observable;
import java.util.Observer;

/**
 * @Author Mi_Tao
 * @Date 2023/7/23
 * @Description
 * @Version 1.0
 **/
public class Reader implements Observer {

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    // 读者的姓名
    private String name;

    @Override
    public void update(Observable o, Object arg) {
        // 推
        System.out.println(name +"收到报纸了，阅读先.目标过来的内容是:"+ arg);

        // 拉
        System.out.println(name +"收到报纸了，阅读先.主动拉倒的内容是 :"+((NewsPaper)o).getContent());
    }
}
